package com.espier.t9keyboard;



import java.util.ArrayList;
import java.util.List;

public class KeyWord {

    private String key[];

    public  KeyWord(String[] k) {
        key = k;
    }
    public  KeyWord(String[] k,String s) {
        key=new String[k.length+1];
        System.arraycopy(k, 0, key, 0, k.length);
        key[k.length]=s;
    }

    public String[] getKey() {
        return key;
    }

    public void setKey(String[] key) {
        this.key = key;
    }
    
    public String getSelection(){
        if(key==null||key.length==0){
            return "";
        }
        StringBuilder selection=new StringBuilder();
        for(String s:key){
            selection.append("% "+s);
        }
        selection.delete(0, 2);
        return selection.toString();
    }
    public String getRegex(){
        if(key==null||key.length==0){
            return "";
        }
        StringBuilder regex=new StringBuilder();
        for(String s:key){
            regex.append(" "+s+".*");
        }
        regex.delete(0, 1);
        return regex.toString();
    }

    @Override
    public String toString() {
        // TODO Auto-generated method stub
        StringBuilder strs=new StringBuilder();
        for(String s:key){
            strs.append(s+" ");
        }
        return strs.toString();
    }
    

 
}
